PROJECT ( biosignal CXX )
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

SET(BIOSIGNAL_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake/modules" CACHE INTERNAL "")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${BIOSIGNAL_CMAKE_DIR}")

SET(BIOSIGNAL_MAJOR_VERSION 0)
SET(BIOSIGNAL_MINOR_VERSION 1)
SET(BIOSIGNAL_BUILD_VERSION 0)
SET(BIOSIGNAL_VERSION
  "${BIOSIGNAL_MAJOR_VERSION}.${BIOSIGNAL_MINOR_VERSION}.${BIOSIGNAL_BUILD_VERSION}")
SET(BIOSIGNAL_API_VERSION
  "${BIOSIGNAL_MAJOR_VERSION}.${BIOSIGNAL_MINOR_VERSION}")
SET(BIOSIGNAL_LIBRARY_PROPERTIES ${BIOSIGNAL_LIBRARY_PROPERTIES}
  VERSION "${BIOSIGNAL_VERSION}"
  SOVERSION "${BIOSIGNAL_API_VERSION}"
)

SET(BIOSIGNAL_LIB_API biosignal-${BIOSIGNAL_API_VERSION})


ENABLE_TESTING()
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(bindings)
ADD_SUBDIRECTORY(test)

CONFIGURE_FILE(
    ${CMAKE_CURRENT_SOURCE_DIR}/biosignal-config.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/biosignal-config.cmake
    @ONLY
)
INSTALL(FILES
    ${CMAKE_CURRENT_BINARY_DIR}/biosignal-config.cmake
    DESTINATION ${BIOSIGNAL_INSTALL_LIB_DIR}/${BIOSIGNAL_LIB_API}
)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "BioSignal library to access time based records in medicine")
SET(CPACK_PACKAGE_CONTACT "zojeda@gmail.com")
SET(CPACK_PACKAGE_VENDOR "zojeda")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT")
SET(CPACK_PACKAGE_VERSION_MAJOR "${BIOSIGNAL_MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${BIOSIGNAL_MINOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_PATCH "${BIOSIGNAL_BUILD_VERSION}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "BioSignal ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME
  "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_SOURCE_IGNORE_FILES
  "/build/;/.hg/;~$;${CPACK_SOURCE_IGNORE_FILES}")
SET(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
  # There is a bug in NSI that does not handle full unix paths properly. Make
  # sure there is at least one set of four (4) backlasshes.
  SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous Project")
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.my-project-home-page.org")
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
  SET(CPACK_NSIS_CONTACT "zaca@zojeda.com.ar")
  SET(CPACK_NSIS_MODIFY_PATH ON)
INCLUDE(CPack)

